<% @assignments = Assignment.find_by_team(@team_id).select {|d| d[:date_sql].to_date > Time.now.to_date and
																d[:date_sql].to_date < (Time.now + 13.weeks).to_date} %>

<h3>River Valley Church</h3>
<h2><%= Team.find(@team_id).name %> Volunteer Schedule</h2>

<div id="message-black">
	For the period beginning <%= Time.now.to_date.strftime('%m/%d/%Y') %> through <%= (Time.now + 13.weeks).to_date.strftime('%m/%d/%Y') %>
</div>



<div id="assignments-enclosure">
	<ul>
	<% @assignments.group_by(&:instance_type_name).sort.each do |d,itn,g,assign| %>
		<li>
		<div class="group-one"><%= d %>	</div>
			<% itn.group_by(&:date_sql).sort.each do |itn, g, assign| %>
				<div class="group-two"><%= itn.to_date.strftime('%m/%d/%Y') %></div>
					<% g.group_by(&:group_name).each do |g, assign| %>
						<div class="group-three"><%= g %></div>
						
								<div class="group-four">
									<%= assign.collect {|a| a.full_name_b}.to_sentence %>
								</div>
						
					<% end %>
			<% end %>	
	   	</li>
	<% end %>
	
		<li>
			<strong>Team Phone List</strong><br>
			<% Team.find(@team_id).involved_people.each do |i| %>
				<div id="group_one">
					<%= i.full_name %> <span id="message-black">
											(<% if i.best_phone.nil? %>no phone)
											<% else %><%= i.best_phone.s_formatted %>)
											<% end %>
									   </span>
				</div>
			<% end %>
		</li>
	
	</ul>
</div>